package com.bailun91.auth.mapper;


import com.bailun91.auth.dto.UserDto;
import com.bailun91.auth.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface UserMapper extends BaseMapper<User> {

  @Select("select * from c_user where username = #{username}")
  User findByUsername(@Param("username") String username);


  @Select("select * from c_user where id=#{userId}")
  User findById(@Param("userId") int id);


  @Select("select * from c_user where username = #{username} and password = #{pwd}")
  User findByUsernameAndPwd(@Param("username") String username, @Param("pwd") String pwd);

  @Select("select * from c_user where username = #{username}")
  UserDto findUserPermissionByUsername(@Param("username") String username);


  @Select("select * from c_user where id=#{userId}")
  UserDto findUserPermissionById(@Param("userId") int id);


  @Select("select * from c_user where username = #{username} and password = #{pwd}")
  UserDto findUserPermissionByUsernameAndPwd(@Param("username") String username, @Param("pwd") String pwd);


}
